import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/views/layout/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: Layout,
      redirect:'/home',
      children:[
        {path:'/home',
      component:()=>import('@/views/home/index.vue'),  
      meta: { title: '主页', icon: 'House' }
      }
      ]
    },
    {
      path: '/login',
      name: 'login',
      hidden: true,
      component: () => import('@/views/login/index.vue')
    },
    {
      path: '/clue',
      component: Layout,
      children: [
        {
          path: '',
          component: () => import('@/views/clue/index.vue'),
          meta: {
            title: '线索管理',
            icon: 'House'
          }
        }
      ]
    }, 
    {
      path: '/business',
      component: Layout,
      children: [
        {
          path: '',
          component: () => import('@/views/business/index.vue'),
          meta: {
            title: '商机管理',
            icon: 'House'
          }
        }
      ]
    },
    {
      path: '/contract',
      component: Layout,
      children: [
        {
          path: '',
          component: () => import('@/views/contract/index.vue'),
          meta: {
            title: '合同管理',
            icon: 'House'
          }
        }
      ]
    },
    {
      path: '/basedata',
      component: Layout,
      meta: {
        title: '基础数据维护',
        icon: 'House'
      },
      children: [
        {
          path: '/basedata/course',
          component: () => import('@/views/basedata/course.vue'),
          meta: {
            title: '课程管理'
          }
        },
        {
          path: '/basedata/active',
          component: () => import('@/views/basedata/index.vue'),
          meta: {
            title: '活动管理'
          }
        }
      ]
    },
    {
      path: '/statistic',
      component: Layout,
      children: [
        {
          path: '',
          component: () => import('@/views/statistic/index.vue'),
          meta: {
            title: '统计分析',
            icon: 'House'
          }
        }
      ]
    },
    {
      path: '/system',
      component: Layout,
      meta: {
        title: '系统管理',
        icon: 'House'
      },
      children: [
        {
          path: '/system/inform',
          component: () => import('@/views/system/index.vue'),
          meta: {
            title: '通知中心',
            icon: 'House'
          }
        },
        {
          path: '/system/authority',
          // component:  Layout,
          meta: {
            title: '权限管理',
            icon: 'House'
          },
          children:[
            {
              path: '/system/authority/user',
              component: () => import('@/views/system/authority/user.vue'),
              meta: {
                title: '用户管理'
              }
            },
            {
              path: '/system/authority/role',
              component: () => import('@/views/system/authority/role.vue'),
              meta: {
                title: '角色管理'
              }
            },
            {
              path: '/system/authority/menus',
              component: () => import('@/views/system/authority/menus.vue'),
              meta: {
                title: '菜单管理'
              }
            },
            {
              path: '/system/authority/section',
              component: () => import('@/views/system/authority/section.vue'),
              meta: {
                title: '部门管理'
              }
            },
            {
              path: '/system/authority/post',
              component: () => import('@/views/system/authority/post.vue'),
              meta: {
                title: '岗位管理'
              }
            }
          ]
        }
      ]
    },
    {
      path: '/dictionaries',
      component: Layout,
      children: [
        {
          path: '',
          component: () => import('@/views/dictionaries/index.vue'),
          meta: {
            title: '字典管理',
            icon: 'House'
          }
        }
      ]
    },
    {
      path: '/clueAllocation',
      component: Layout,
      children: [
        {
          path: '',
          component: () => import('@/views/clue-allocation/index.vue'),
          meta: {
            title: '线索配置',
            icon: 'House'
          }
        }
      ]
    }, 
    {
      path: '/businessAllocation',
      component: Layout,
      children: [
        {
          path: '',
          component: () => import('@/views/business-allocation/index.vue'),
          meta: {
            title: '商机配置',
            icon: 'House'
          }
        }
      ]
    },
    {
      path: '/log',
      component: Layout,
      children: [
        {
          path: '',
          component: () => import('@/views/log/index.vue'),
          meta: {
            title: '系统日志',
            icon: 'House'
          }
        }
      ]
    },
    {
      path: '/quit',
      component: Layout,
      children: [
        {
          path: '',
          component: () => import('@/views/quit/index.vue'),
          meta: {
            title: '退出系统',
            icon: 'House'
          }
        }
      ]
    },
  ]
})

export default router
